package com.mdc;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;

@ServletComponentScan
@SpringBootApplication
public class Application {

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

	@Bean//注意，这里的@Bean注释是必不可少的
	public ServletRegistrationBean myServlet(){
		ServletRegistrationBean regBean =
				new ServletRegistrationBean(new MyServlet());
		regBean.addUrlMappings("/a");
		regBean.addUrlMappings("/a-servlet");
		regBean.setLoadOnStartup(1);
		return regBean;
	}
}
